import {request} from 'umi';
export interface Params {
    isAsc: string;
    pageNum: number;
    pageSize: number;
    sxtype: number;
    status: number;
    proName: string;
    newProjectList: number;
    specialtyTag?:string;
    industryTag?:string;
}
interface commonts{
    id: string;
    pageNum: number;
    pageSize: number;
}
interface postComponent{
    discussDesc: string
    proId: string
}

// 获取项目 专业列表
export let getProlabel = ()=>{
    return request('/sxpt/label/selectMajorStationList')
}

// 获取项目 行业列表
export let getProTradeList = ()=>{
    return request('/sxpt/label/selectTradeList')
}

// 获取项目 table列表
export let getProselectList = (params:Params)=>{
    return request('/sxpt/project/selectProjectList',{params})
}

// 获取添加项目 实训大纲
export let getProBriefTree = ()=>{
    return request('/sxpt/brief/selectBriefTree')
}

// 获取添加项目 项目资源
export let getResourceTree = ()=>{
    return request('/sxpt/projectResource/selectResourceTree')
}

// 获取添加项目 前置项目
export let getPushProList = ()=>{
    return request('/sxpt/frontPositionProject/selectPushProjectList')
}

// 获取详情
export let getProDetail = (id:string | string[])=>{
    return request(`/sxpt/project/selectProjectByVserionId?versionId=${id}`)
}

// 添加项目
export let addProTable = ({...formValues})=>{
    // console.log('aaaaaaaaa',{...formValues,id:'',knowledge:[],majorId:'',stationId:'',tradeId:'',versionId:''})
    return request('/sxpt/project',{
        method:'POST',
        data:{...formValues,id:'',knowledge:[],majorId:'',stationId:'',tradeId:'',versionId:''}
    });
}

// 图片上传
export let upLoadImg = (data:File)=>{
    return request('/common/upload',{
        method:'POST',
        data
    })
}


// 删除项目列表
export let delTables = (id:string)=>{
    // console.log('接口执行了........')
    return request(`/sxpt/project/deleteProjectByVersionId?projectVersionId=${id}`,{
        method:'DELETE'
    })
}

// 重新获取
export let delLists = (params:Params)=>{
    return request('/sxpt/project/selectProjectList',{params})
}

// 获取学生评论数据
export let getComments = (params:commonts)=>{
    return request('/sypt/discuss/list',{params})
}

// 发布评论
export let postComment = (data:postComponent)=>{
    return request('/sypt/discuss',{
        method:'POST',
        data
    })
}